package com.cimu.quartz.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.cimu.quartz.entity.ScheduleJobLog;
import com.cimu.quartz.mapper.ScheduleJobLogMapper;
import com.cimu.quartz.service.ScheduleJobLogService;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;

@Service
public class ScheduleJobLogServiceImpl extends ServiceImpl<ScheduleJobLogMapper, ScheduleJobLog> implements ScheduleJobLogService {

	@Override
	public Page<ScheduleJobLog> queryPage(Page<ScheduleJobLog> page,
										  ScheduleJobLog scheduleJobLog) {
		String jobId = scheduleJobLog.getJobId()==null?"":String.valueOf(scheduleJobLog.getJobId());
		EntityWrapper<ScheduleJobLog> ew = new EntityWrapper<ScheduleJobLog>();
		ew.like(StringUtils.isNotBlank(jobId),"job_id",jobId);
		ew.orderBy("create_time",false);
		return this.selectPage(page,ew);
	}

}
